<template>
  <div>
    <el-card class="box-card">
      <el-row style="height: 50px" :gutter="10">
        <el-col :span="7">
          <span>医生ID:<el-input placeholder="请输入ID查找" @change="search" class="input" v-model="find1" size="mini"/></span>
        </el-col>
      </el-row>
      <el-table
              :data="tableData"
              border
              style="width: 100%">
        <el-table-column
                prop="memberid"
                label="会员id"
                width="50">
        </el-table-column>
        <el-table-column
                prop="username"
                label="用户名"
                width="150">
        </el-table-column>
        <el-table-column
                prop="memberName"
                label="会员姓名"
                width="120">
        </el-table-column>
        <el-table-column
                prop="rechargemethod"
                label="充值方式"
                width="120">
        </el-table-column>
        <el-table-column
                prop="rechargeamount"
                label="充值金额"
                width="120">
        </el-table-column>
        <el-table-column
                prop="userid"
                label="操作人"
                width="120">
        </el-table-column>
        <el-table-column
                prop="createdate"
                label="创建时间"
                width="120">
        </el-table-column>

      </el-table>
      <el-row>
        <el-col offset="6">
          <el-pagination
                  @size-change="handleSizeChange"
                  @current-change="handleCurrentChange"
                  :current-page="currentPage4"
                  :page-sizes="[5, 10, 15, 20]"
                  :page-size="page.pageSize"
                  layout="total, sizes, prev, pager, next, jumper"
                  :total="page.total">
          </el-pagination>
        </el-col>
      </el-row>
    </el-card>
  </div>
</template>

<script>
  import { findAll } from '@/network/paymentDetails'

  export default {
    name: 'PaymentDetails',
    created() {
      this.findAll()
    },
    methods: {
      add() {
        console.log("添加用户")
        this.$router.push("memberAdd")
      },
      edit(row)  {
        window.sessionStorage.setItem("memberid", row.memberid)
        this.$router.push("memberEdit")
      },
      memberTopUp(row) {
        window.sessionStorage.setItem("memberid", row.memberid)
        this.$router.push("memberTopUp")
      },
      del(row) {
        console.log(row);
        del(row.memberid).then(res => {
          this.findAll()
        })
      },
      handleSizeChange(val) {
        this.page.pageSize = val
        this.findAll()
      },
      handleCurrentChange(val) {
        this.page.pageNo = val
        this.findAll()
      },
      findAll() {
        findAll(this.page).then(res => {
          console.log(res)
          console.log(res.data.data)
          this.currentPage4 = res.data.data.current
          this.tableData = res.data.data.records
          this.page.pageNo = res.data.data.current
          this.page.pageSize = res.data.data.size
          this.page.total = res.data.data.total
        })
      },
      search() {

      }
    },

    data() {
      return {
        currentPage1: 5,
        currentPage2: 5,
        currentPage3: 5,
        currentPage4: 3,
        tableData: [],
        page: {
          pageNo: 1,
          pageSize: 5,
          total: ''
        },
        find1: '',
        find2: '',
        find3: '',
      }
    }
  }
</script>

<style scoped>

</style>
